<template>
    <div class="g-goods-item">
        <p>{{good.id}}</p>
        <p>{{good.name}}</p>
        <p>{{good.price}}</p>
        <p>{{good.num}}</p>
        <!-- <button @click="bindDelete(good.id)">删除</button> -->
        <button @click="$emit('onDeleteGood',good.id)">删除</button>
    </div>
</template>

<script setup>
defineProps(['good'])
const emit = defineEmits(['onDeleteGood'])

const bindDelete = (id)=>{
    emit('onDeleteGood',id) // 触发自定义事件
}
</script>

<style lang="css" scoped>
.g-goods-item{
    display: flex;
    justify-content: space-around;
    background-color: rgb(193, 68, 89);
}
</style>